package edu.sjsu.cs.zoo;

import java.util.Scanner;

public class Zoo
{
   public static void main(String[] args)
   {
      Animal zoo[] = new Animal[3];
      
      zoo[0] = new Dog();
      zoo[1] = new Cat();
      zoo[2] = new Duck();
      
      for(int i=0;i<3;i++)
      {
         System.out.println(zoo[i].talk());
      }
      
      System.out.println("which animal should talk?");
      Scanner input = new Scanner(System.in);
      String line = input.nextLine();
      
      Animal f = null;
      
      if(line.equalsIgnoreCase("dog"))
      {
         f = new Dog();
         
      }
      else if (line.equalsIgnoreCase("cat"))
      {
         f = new Cat();
      }
      else 
      {
         f = new Duck();
      }
      System.out.println(f.talk());
   }
}
